package com.metis.document.parse.dialog.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

//https://github.com/any86/any-rule
@AllArgsConstructor
@Getter
public enum DesensitizationRegexEnum {

    // 身份证号码
    //https://github.com/any86/any-rule#%E8%BA%AB%E4%BB%BD%E8%AF%81%E5%8F%B7-%E6%94%AF%E6%8C%8112%E4%BB%A315%E4%BD%8D18%E4%BD%8D%E6%95%B0%E5%AD%97
    ID_CARD("\\d{6}((((((19|20)\\d{2})(0[13-9]|1[012])(0[1-9]|[12]\\d|30))|(((19|20)\\d{2})(0[13578]|1[02])31)|((19|20)\\d{2})02(0[1-9]|1\\d|2[0-8])|((((19|20)([13579][26]|[2468][048]|0[48]))|(2000))0229))\\d{3})|((((\\d{2})(0[13-9]|1[012])(0[1-9]|[12]\\d|30))|((\\d{2})(0[13578]|1[02])31)|((\\d{2})02(0[1-9]|1\\d|2[0-8]))|(([13579][26]|[2468][048]|0[048])0229))\\d{2}))(\\d|X|x)", "身份证号"),
    // 座机(tel phone)电话(国内),如: 0341-86091234
    //https://github.com/any86/any-rule#%E5%BA%A7%E6%9C%BAtel-phone%E7%94%B5%E8%AF%9D%E5%9B%BD%E5%86%85%E5%A6%82-0341-86091234
    TEL_PHONE("(?:(?:\\d{3}-)\\d{8}|(?:\\d{4}-)\\d{7,8})(?:-\\d+)?", "座机"),
    // 手机号(mobile phone)中国(严谨), 根据工信部2019年最新公布的手机号段
    //https://github.com/any86/any-rule#%E6%89%8B%E6%9C%BA%E5%8F%B7mobile-phone%E4%B8%AD%E5%9B%BD%E4%B8%A5%E8%B0%A8-%E6%A0%B9%E6%8D%AE%E5%B7%A5%E4%BF%A1%E9%83%A82019%E5%B9%B4%E6%9C%80%E6%96%B0%E5%85%AC%E5%B8%83%E7%9A%84%E6%89%8B%E6%9C%BA%E5%8F%B7%E6%AE%B5
    MOBILE_PHONE("(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[01256789]))\\d{8}", "手机号"),
    //车牌号(新能源+非新能源)
    //https://github.com/any86/any-rule#%E8%BD%A6%E7%89%8C%E5%8F%B7%E6%96%B0%E8%83%BD%E6%BA%90%E9%9D%9E%E6%96%B0%E8%83%BD%E6%BA%90
    CAR_NUMBER("[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][^a-zA-Z0-9\\u4e00-\\u9fa5]?[A-HJ-NP-Z][^a-zA-Z0-9\\u4e00-\\u9fa5]?[A-HJ-NP-Z0-9]{4,5}[A-HJ-NP-Z0-9挂学警港澳]", "车牌号"),

    // 20240306 补充
    // bank_card = r'^([1-9]{1})(\d{15}|\d{18})$'
    BANK_CARD("^([1-9]{1})(\\d{15}|\\d{18})$","银行卡号"),

    //mobile_number = r'1[3456789]\d{9}'
    MOBILE_NUMBER("1[3456789]\\d{9}","手机号"),

    //phone_number = r'\d{3}-\d{8}|\d{4}-d{8}|\d{4}-\d{7}|\d{8}'
    PHONE_NUMBER("\\d{3}-\\d{8}|\\d{4}-d{8}|\\d{4}-\\d{7}|\\d{8}","电话号码"),

    //phone_number_three = r'\d{3}-\d{3}-d{4}'
    PHONE_NUMBER_THREE("\\d{3}-\\d{3}-d{4}","3位电话号码"),

    //email = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
    EMAIL("\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b","邮件"),

    //http_url = r'https?://\S*?(?=[^A-Za-z0-9._/\-\:])'
    HTTP_URL("https?://\\S*?(?=[^A-Za-z0-9._/\\-\\:])","HTTP-URL"),

    //url = r'\b(?:https?|ftp):\/\/\S+\b'
    URL("\\b(?:https?|ftp):\\/\\/\\S+\\b","URL"),

    //web_site = r'^www\.[a-zA-Z0-9]+(\.com|\.cn|\.org|\.gov)'
    WEB_SITE("^www\\.[a-zA-Z0-9]+(\\.com|\\.cn|\\.org|\\.gov)","网址"),


    ;
    private final String regex;
    private final String name;

}
